

#include<string>
#include <iostream>

using namespace std;

class Shape
{
  private :
    std::string test;
  protected :
    std::string id;


  public :
    Shape(string id)
    {
      this->id = id;
      cout<< "正在构建Shape" << endl;
    }
    string getId()
    {
      return id;
    }

    ~Shape()
    {
      cout<< "正在析构Shape" << endl;
    }



    virtual double area()
    {
      return 0;
    }


};


class Rectangle : public Shape
{
  private :
    double width;
    double height;

  public:
    Rectangle(std::string id, double width,double height): Shape(id)

    {
      
      this->width = width;
      this->height = height;
    }

    ~Rectangle() 

    {
      this->width = 0;
      this->height = 0;
       cout<< "正在析构Rectangle" << endl;
    }

    double area()
    {
      cout<<"调用父类的方法:"<<Shape::area()<<endl;
      return this->width * this->height;
    }

   

};


int main ()
{
  Rectangle r("test",25.98,26.11);

  cout << "长方形"<<r.getId()<<"的面积:" << r.area()<< endl;
}